<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo $title;?></title>
</head>
<body>
<div class="success">
		<br />
		<h2> THÔNG TIN KPI</h2>
		<br />
		
		<?php 
			ob_start();
			require_once('db.php');
			if(isset($_POST)){
				$kpi_id = $_POST['txtkpid'];	
				$kpi_n	= $_POST['txtkpi'];
				$kpi_u	= $_POST['txtkpiuni'];				
				$kpi_id = strip_tags(mysql_real_escape_string($kpi_id));
				$sql = mysql_query("select * from kpi where kpi_id='$kpi_id'");					
				if(mysql_num_rows($sql)==1 ){	
					echo "KPI này đã tồn tại.";
					}else {						
						$a = mysql_query("insert into kpi(kpi_id,kpi_name,kpi_unit) values ('{$kpi_id}', '{$kpi_n}','{$kpi_u}')");
						if($a)
						{	
							header('Location: http://localhost/qlc/index.php/home/dskpi');
						}else echo "Có lỗi, vui lòng thử lại hoặc liên hệ Quản trị."; 
					}
			}			
			ob_end_flush();
		?>
</div>
</body>
</html>
